import { phoneLogin } from "@/netWork/login"
import * as actionTypes from "./constants"
export const changeshowModalActiom = (visible)=>{
    return {
        type:actionTypes.CHNAGE_SHOW_MODAL,
        visible
    }
}
export const changePhoneVisible = (phoneVisible)=>{
    return {
        type:actionTypes.CHNAGE_PHONE_LOGIN,
        phoneVisible
    }
}
//创建手机登录Action
const changeLoginSucceedInfoAction = (liginSucceedInfo)=>{
    return {
        type:actionTypes.CHNAGE_LOGIN_SUCCEED_INFO,
        liginSucceedInfo
    }
}
export const getLoginSucceedInfoAction = (phone,password)=>{
    return dispatch =>{
        phoneLogin(phone,password).then(res=>{
            dispatch(changeLoginSucceedInfoAction(res))
         })
    }
}
//退出登录
export const changeExitAction= ()=>{
    return dispatch =>(dispatch({
        type:actionTypes.CHNAGE_EXIT,
        liginSucceedInfo:{}
    }))
}
export const changeRegister= (isShowRegister)=>{
    return dispatch =>(dispatch({
        type:actionTypes.CHNAGE_REGISTER,
        isShowRegister
    }))
}